<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-orientation" content="portrait">
    <title>填写联系方式</title>
    <link rel="stylesheet" href="../../styles/h5/reset.min.css"/>
    <link rel="stylesheet" href="../../styles/h5/errortankuang.css"/>
    <!--以上为公共css样式-->
    <link rel="stylesheet" href="../../styles/h5/index.css"/>

    <script charset="utf-8" type="text/javascript" src="../../scripts/h5/jquery-1.9.1.min.js"></script>
    <script charset="utf-8" type="text/javascript" src="../../scripts/h5/jquery.modal.js"></script>
    <!--以上为公共js文件-->
</head>
<body>
<div class="zz-top"></div>
<div class="zz-list zz-city-area">
	<form>
    <ul>
        <li>
            <span class="zz-left">您的姓名</span
            ><input class="zz-code-num zz-payee-name" name="submitName" type="text" placeholder="请输入您的姓名" maxlength="5"/>
        </li>
        <li>
            <span class="zz-left">联系号码</span
            ><input class="zz-code-num zz-phone-code" name="mobileId" type="tel" placeholder="请输入手机或电话号码" maxlength="32"/>
        </li>
        <li class="zz-position">
            <span class="zz-left">所在地区</span
            ><div class="zz-city-list">
                <select class="prov" name="city"></select>
                <span class="zz-sanjiao"></span>
                <select class="city" name="countyCode" disabled="disabled"></select>
                <span class="zz-sanjiao"></span>
            </div>
        </li>
        <li>
            <span class="zz-left">联系地址</span
            ><input class="zz-code-num zz-address" name="address" type="text" placeholder="请输入联系地址" maxlength="64"/>
        </li>
        <li>
            <span class="zz-left">店铺名称</span
            ><input class="zz-code-num zz-store-short-name" name="storeShortName" type="text" placeholder="请输入店铺名称" maxlength="32"/>
        </li>
    </ul>
    <input name="source" type="hidden" value="H5推广页"/>
    </form>
</div>
<input class="footer zz-footTop" type="button" value="立即提交">
<div class="zz-explain" style="display: none">
    <p class="zz-phone-explain"></p>
    <div class="zz-bank-reserve"></div>
    <span class="zz-know"></span>
</div>
<div class="zz-mask" style="display: none"></div>
</body>
<script charset="utf-8" type="text/javascript" src="../../scripts/h5/jquery.cityselect.js"></script>
<script charset="utf-8" type="text/javascript">
    $(function () {
        $(".zz-city-list").citySelect({
            prov: "南京",
            nodata: "none"
        });
    });

</script>
<script charset="utf-8" type="text/javascript" src="../../scripts/h5/utils.js"></script>
<script charset="utf-8" type="text/javascript" src="../../scripts/h5/index.js"></script>
<script charset="utf-8" type="text/javascript">


	$know.click(function () {
        $explain.hide();
        $mask.hide();
        $footer.removeAttr("disabled");
        WeixinJSBridge.call('closeWindow');
    });

    $footer.click(function () {
        //判断姓名
        var submitName = $(".zz-payee-name").val();
        var address = $(".zz-address").val();
        var storeShortName = $(".zz-store-short-name").val();
        var city = $(".zz-city-list select.prov").val();
        var countyCode = $(".zz-city-list select.city").val();
        var source = "微信公众号";
        //只能中 文 长度2-5之间;
        if (!utils.effectiveName(submitName, $footer)) {
            return false;
        };

        //判断手机号
        var num = /^\d{7,32}$/;
        var mobileId = utils.removeSpace($(".zz-phone-code").val());
        if (!num.test(mobileId)) {
            new $.modal({
                content: '请输入正确的联系方式!',//弹框内容
                showcontent: true,//false为弹出框组件二，true为弹出框组件一
            }).show($footer);
            return false;
        };

        if (utils.removeSpace(address).length == 0 ||address.length > 64) {
            //if (address.length > 64) {
                new $.modal({
                    content: '请输入正确的地址！',//弹框内容
                    showcontent: true,//false为弹出框组件二，true为弹出框组件一

                }).show($footer);
                return false;
            //}
        };

        if (utils.removeSpace(storeShortName).length == 0 || storeShortName.length > 32) {
            new $.modal({
                content: '请输入正确的店铺名称！',//弹框内容
                showcontent: true,//false为弹出框组件二，true为弹出框组件一

            }).show($footer);
            return false;
        };
        
        new $.modal({
            content: "加载中",
            animation: true//调用动画
        }).show();
        //$footer.attr("disabled", "true");
        
        $.ajax({
            //url: "http://10.10.133.115:8080/spEnterprise/saas/expansionInfoAction!saveExpansion.action",
            url: utils.ajaxUrl()+"h5/developmentController/saveBusiExpansionStore",
            async: false,
            data: {
                submitName: submitName,
                mobileId: mobileId,
                city: city,
                countyCode: countyCode,
                address: address,
                storeShortName: storeShortName,
                source:source
            },
            type: 'get',
            success: function (res) {
            	var res = JSON.parse(res);
            	//console.log(res);
                if (res && res.retCode == '0000') {
                	
                	new $.modal({
            			animation: true,//调用动画
        			}).hide(0);
        			
        			$footer.attr("disabled", "true");
                	$(".zz-explain .zz-phone-explain").html("提示");
                    $(".zz-explain .zz-bank-reserve").html("提交成功，我们将在今天（工作日）电话联系您，请保持电话畅通，谢谢。");
                    $(".zz-explain .zz-know").html("确认");
                    $explain.show();
                    $mask.show();
                } else {
                	new $.modal({
            			animation: true,//调用动画
        			}).hide(0);
                    new $.modal({
                        content: res.retMsg,//弹框内容
                        showcontent: true,//false为弹出框组件二，true为弹出框组件一
                    }).show($footer);
                }
            }
        });
        
        
    })

</script>
</html>